{extend name="new/template/base" /}

{block name="area_header"}
	{include file="new/template/base_bootstrap" /}
<script type="text/javascript" src="__CDN__jquery-validation/1.13.1/jquery.validate.min.js"></script>
<script type="text/javascript" src="__CDN__jquery-validation/1.13.1/localization/messages_zh.min.js"></script>
<link rel="stylesheet" type="text/css" href="__CDN__comp/wxuploader.css" />
<link type="text/css" rel="stylesheet" href="__CDN__jquery-uploadify/3.2.1/uploadify.css" />
<script type="text/javascript" src="__CDN__jquery-uploadify/3.2.1/jquery.uploadify.min.js"></script>
{/block}

{block name="area_body"}
	<div class="admin-main container-fluid">
		<div class="admin-main-content">

			<!-- 带验证 form -->
			<form class="form-horizontal well validateForm">
				<input type="hidden" name="parent" value="{$parent}" />
				<input type="hidden" name="id" value="{$vo.id}" />
				<fieldset>
					<legend>
						数据字典－添加</legend>
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">数据编码</label>
						<div class="col-md-10 col-lg-10">
							<input type="text" value="{$vo.code}" readonly class="required form-control input-short" name="code" id="inputcode" placeholder="编码唯一">
							<div class="help-block">(数据编码,不能编辑)</div>
						</div>
					</div>
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">名称</label>
						<div class="col-md-10 col-lg-10">
							<input type="text" class="required form-control input-short" value="{$vo.name}" name="name" id="inputtitle" placeholder="请输入名称不要超过30个字">
							<div class="help-block">(请输入名称不要超过30个字)</div>
						</div>
					</div>
					<div class="form-group">
						<label for="alias" class="col-md-2 col-lg-2 control-label">别名<br/>（选填</label>
						<div class="col-md-10 col-lg-10">
							<input type="text" class="form-control input-short" name="alias" id="alias" value="{$vo.alias}" placeholder="请输入代码">
							<div class="help-block"></div>
						</div>
					</div>

					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">图标<br/>（选填）</label>
						<div class="col-md-10 col-lg-10">
							<input type="hidden" class="required form-control input-short" id="iconurl" name="iconurl"  >

							<!-- 图片选择DOM结构 -->
							<div class="wxuploaderimg clearfix banner  {notempty name="vo.iconurl"}checked{/notempty}" data-maxitems="1">
								<div class="img-preview clearfix" >
									{notempty name="vo.iconurl"}
											<div class="pull-left clearfix img-item">
												<img src="{$vo.iconurl}" />
												<div class="edit_pic_wrp"><a href="javascript:;" class="fa fa-lg fa-trash js_delete"></a></div>
											</div>
									{/notempty}
								</div>
								<div class="add">
									<i class="fa fa-plus"></i>
								</div>
							</div>
							<!-- 图片选择DOM结构 -->

							<div class="help-block">(图标,可不填)</div>
						</div>
					</div>

		<div class="form-group">
			<label for="inputtitle" class="col-md-2 col-lg-2 control-label">数据等级</label>
			<div class="col-md-10 col-lg-10">
				<label class="radio-inline">
					<input {eq name="$vo['data_level']" value="0"}checked="checked"{/eq} type="radio" name="data_level" value="0" class="onshelf"
					/>应用级
				</label>
				<label class="radio-inline">
					<input {eq name="$vo['data_level']" value="1"}checked="checked"{/eq} type="radio" name="data_level" value="1" class="onshelf"
					/>系统级
				</label>
			</div>
		</div>
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">排序</label>
						<div class="col-md-10 col-lg-10">
							<input type="text" class="required form-control input-short" value="{$vo.sort}" name="sort"  placeholder="">
							<div class="help-block">(请输入排序，从大到小排序)</div>
						</div>
					</div>

					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">备注</label>
						<div class="col-md-10 col-lg-10">
							<textarea rows="3" name="notes" class="form-control">{$vo.notes}</textarea>
							<div class="help-block">(备注，选填)</div>
						</div>
					</div>

					<div class="form-group">
						<label for="btns" class="col-md-2 col-lg-2 control-label">&nbsp;</label>
						<div class="col-lg-10 col-md-10">
							<a target-form="validateForm" onclick="return getData();" class="ajax-post btn btn-primary" href="{:url('Datatree/edit',array('id'=>$vo['id']))}" autofocus="autofocus"><i class="fa fa-save"></i> {:L('BTN_SAVE')}</a>
							<a class="btn btn-default" href="{:url('Datatree/index',array('parent'=>$parent))}"><i class="fa fa-times-circle"></i> {:L('BTN_CANCEL')}</a>
						</div>
					</div>
				</fieldset>
			</form>
			<!-- form -->
			{include file="default/template/wxpicture" /}

		</div>
		<!-- END admin-main-content -->
	</div>
		<!-- END admin-main-->
{/block}

{block name="area_footer"}
<script type="text/javascript">
	function getData(){
		var img = $(".wxuploaderimg img").attr("src");
		$("#iconurl").val(img);

		return true;
	}

	$(function(){
			wxuploadimg.init({cont:".wxuploaderimg"});
	});
	</script>
{/block}